package com.huike.business.service.impl;


import com.huike.business.service.ITbBusinessTrackRecordService;
import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 商机跟进记录Service业务层处理
 * 
 * @author wgl
 * @date 2021-04-28
 */
@Service
public class TbBusinessTrackRecordServiceImpl implements ITbBusinessTrackRecordService {

    @Autowired
    private TbClueMapper clueMapper;
    @Autowired
    private TbClueTrackRecordMapper recordMapper;

    /**
     * 插入跟进记录
     * @param clue
     * @param record
     * @return
     */
    @Override
    @Transactional
    public int insertTbClueTrackRecordAndupdateTbClue(TbClue clue, TbClueTrackRecord record) {
        clueMapper.updateTbClue(clue);
        int rows =recordMapper.insert(record);

        return rows;
    }

    /**
     * 查询记录
     * @param clueId
     * @return
     */
    @Override
    public List<TbClueTrackRecord> selectAllByClueId(Long clueId) {
        return recordMapper.selectAllByClueId(clueId);
    }
}
